﻿#define _CRT_SECURE_NO_WARNINGS

#include"HashTable.h"

int main()
{
	Hash_Bucket::HashTable<int, int> hashtable;
	int a2[] = { 19,30,5,36,13,20,21,12,24,96 };
	for (auto e : a2)
	{
		hashtable.Insert({ e, e });
	}
	/*hashtable.Insert({ 100, 100 });
	hashtable.Insert({ 101, 101 });*/
	/*cout << hashtable.Find(96) << endl;
	cout << hashtable.Find(30) << endl;
	cout << hashtable.Find(19) << endl << endl;

	hashtable.Erase(96);
	hashtable.Erase(19);
	hashtable.Erase(30);

	cout << hashtable.Find(96) << endl;
	cout << hashtable.Find(30) << endl;
	cout << hashtable.Find(19) << endl<<endl;*/

	Hash_Bucket::HashTable<int, int> hashtable_copy = hashtable;
	Hash_Bucket::HashTable<int, int> hashtable2 = hashtable;
	return 0;
}

/*HashTable<K, V> newHT;
newHT._tables.resize(__stl_next_prime(_tables.size()+1);
for (size_t i = 0; i < _tables.size(); i++)
{
	Node* cur = _tables[i];
	while(cur)
	{
		newHT.Insert(cur->_kv);
		cur = cur->_next;
	}
}
_tables.swap(newHT._tables);*/
// 这⾥如果使⽤上⾯的⽅法，扩容时创建新的结点，后⾯还要释放旧结点，浪费了
// 下⾯的⽅法，直接移动旧表的结点到新表，效率更好